package mt.demo.web.controller;

import mt.demo.service.comm.WatControllerDefaultData;
import mt.demo.service.security.WatUserDetails;
import mt.demo.web.comm.YomsException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by mt on 2015/7/23.
 */
@Controller
public class DefaultController {
    @Autowired
    private WatControllerDefaultData defaultData;

    @RequestMapping(value = "login.server", method = RequestMethod.GET)
    public String login() throws YomsException {
        WatUserDetails details = defaultData.getCurrentYomsUserDetails();
        if (details != null) {
            return "index";
        } else {
            return "login";
        }
    }
}
